package com.itany.corejava.day08;

public class Test1 {
    public static void main(String[] args) {

        Marines marines1=new Marines();
        Marines marines2=new Marines();
        Marines marines3=new Marines();
        Tank tank1=new Tank();
        Tank tank2=new Tank();
        Doctors doctors1=new Doctors();

        Mobile[] mobiles=new Mobile[]{marines1,marines2,marines3,tank1,tank2,doctors1};

        for (int i = 0; i < mobiles.length; i++) {
            mobiles[i].move();
            if(mobiles[i] instanceof Attackable){
                ((Attackable) mobiles[i]).attack();
            }
        }








    }
}
